unit about;

{$mode ObjFPC}{$H+}

interface

uses
  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls,
  ComCtrls, ButtonPanel, fileinfo;

type

  { Tform_about }

  Tform_about = class(TForm)
    btn_panel_about: TButtonPanel;
    Image1: TImage;
    memo_release_note: TMemo;
    memo_version_info: TMemo;
    page_control_version: TPageControl;
    TabSheet1: TTabSheet;
    TabSheet2: TTabSheet;
    procedure FormShow(Sender: TObject);
    procedure OKButtonClick(Sender: TObject);
  private

  public

  end;

var
  form_about: Tform_about;

implementation

{$R *.lfm}

{ Tform_about }

procedure Tform_about.FormShow(Sender: TObject);
var
  file_ver_info: TFileVersionInfo;
  app_path: string;
begin

  // 版本信息
  file_ver_info := TFileVersionInfo.Create(nil);
  try
  file_ver_info.ReadFileInfo;
  with memo_version_info.Lines do
  begin
    Clear;
    Add(file_ver_info.VersionStrings.Values['ProductName']);
    Add('原生/本地/极速/跨平台笔记软件！');
    Add('');
    Add(Format('Version:%s (2024/9/22)', [file_ver_info.VersionStrings.Values['ProductVersion']]));
    Add('官网:https://www.zjsbt.cn/#/service/derivatives');
    Add('邮箱：riverbird@aliyun.com');
    Add('');
    Add(Format('%s 出品', [file_ver_info.VersionStrings.Values['CompanyName']]));
    Add('');
    Add('更多功能，推荐使用布尔笔记：https://www.zjsbt.cn/#/service/derivatives')
  end;
  finally
    file_ver_info.Free;
  end;

  // Release note
  app_path := ExtractFilePath(ParamStr(0));
  memo_release_note.Lines.LoadFromFile(Format('%s/releasenote.txt', [app_path]));

  // 默认显示首个tab
  page_control_version.TabIndex:= 0;
end;

procedure Tform_about.OKButtonClick(Sender: TObject);
begin
  self.Close;
end;

end.
